package com.alibaba.csp.sentinel.dashboard.rule.nacos;

/**
 * packageName com.alibaba.csp.sentinel.dashboard.rule.nacos.SystemRuleNacosProvider
 *
 * @author liudonghai
 * @version JDK 11
 * @date 2025/8/1
 * @description TODO
 */

import com.alibaba.csp.sentinel.dashboard.config.NacosRuleConstants;
import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.SystemRuleEntity;
import com.alibaba.nacos.api.config.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 系统规则 Nacos 提供者
 * 实现从 Nacos 配置中心读取系统规则
 */
@Component("systemRuleNacosProvider")
public class SystemRuleNacosProvider extends NacosDynamicRuleProvider<SystemRuleEntity> {
    @Autowired
    public SystemRuleNacosProvider(ConfigService configService) {
        super(configService);
    }

    @Override
    protected String getDataIdPostfix() {
        return NacosRuleConstants.SYSTEM_DATA_ID_POSTFIX;
    }

    @Override
    protected Class<SystemRuleEntity> getRuleClass() {
        return SystemRuleEntity.class;
    }

}